package com.asiainfo.cms.system.vo;

import com.asiainfo.cms.system.entity.SysDept;
import com.asiainfo.cms.system.entity.SysRole;
import com.asiainfo.cms.system.entity.SysUser;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
public class SysUserVO extends SysUser {


    private SysDept dept;

    /**
     * 角色对象
     */
    private List<SysRole> roles;

    /**
     * 角色组
     */
    private Long[] roleIds;

    /**
     * 岗位组
     */
    private Long[] postIds;

    /**
     * 角色ID
     */
    private Long roleId;

    public boolean isAdmin() {
        return isAdmin(getUserId());
    }

    public static boolean isAdmin(Long userId) {
        return userId != null && 1L == userId;
    }
}
